%code.installation
  gem install livingstyleguide
.links
  .links--container
    %a.links--item.-github(href="https://github.com/hagenburger/livingstyleguide#readme") Documentation
    %a.links--item.-issues(href="https://github.com/hagenburger/livingstyleguide/issues") Open issues
    %a.links--item.-twitter(href="https://twitter.com/LSGorg") Follow for Updates
    %a.links--item.-example-project(href="https://github.com/hagenburger/livingstyleguide-example") Example Projects
%footer.footer
  %a.footer--made-in-berlin(href="http://www.hagenburger.net/BLOG/Made-in-Berlin.html") Made in Berlin
  %a.footer--made-by-hagenburger(href="http://www.hagenburger.net") Nico Hagenburger
  %a.footer--contact(href="http://www.hagenburger.net/CONTACT.html") Contact
  %a.footer--contact(href="/code-of-conduct.html") Code of Conduct
%script(src="//code.jquery.com/jquery-2.1.3.min.js")
%script
  :plain
    var _paq = _paq || [];
    _paq.push(["trackPageView"]);
    _paq.push(["enableLinkTracking"]);

    (function() {
      #{"return;" unless environment == :build}
      var u=(("https:" == document.location.protocol) ? "https" : "http") + "://nh.fornax.uberspace.de/piwik/";
      _paq.push(["setTrackerUrl", u+"piwik.php"]);
      _paq.push(["setSiteId", "2"]);
      var d=document, g=d.createElement("script"), s=d.getElementsByTagName("script")[0]; g.type="text/javascript";
      g.defer=true; g.async=true; g.src=u+"piwik.js"; s.parentNode.insertBefore(g,s);
    })();
    $('a[href^="/"]').click(function(e) {
      e.preventDefault();
      var url = this.href;
      $('body')[url.match(/\/$/) ? 'removeClass' : 'addClass']('-subpage-');
      $('.layout--content').animate({ opacity: 0 });
      $.get(url).done(function(html) {
        $('.layout--content').replaceWith($(html).find('.layout--content'))
        history.pushState({}, $('title').text(), url);
        initSocialMedia();
      })
    })
    function initSocialMedia() {
      fb = (function(d, s, id) {
        var js, fjs = d.getElementsByTagName(s)[0];
        if (d.getElementById(id)) {return;}
        js = d.createElement(s); js.id = id;
        js.src = "//connect.facebook.net/en_GB/all.js#xfbml=1&appId=565452553545873";
        fjs.parentNode.insertBefore(js, fjs);
      });
      window.setTimeout(function(){fb(document, 'script', 'facebook-jssdk');}, 250);
      (function() {
        var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
        po.src = 'https://apis.google.com/js/plusone.js?onload=onLoadCallback';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
      })();
      !function(d, s, id){
        var js,fjs = d.getElementsByTagName(s)[0];
        if(!d.getElementById(id)) {
          js = d.createElement(s);
          js.id = id;
          js.async = true;
          js.src = "//platform.twitter.com/widgets.js";
          fjs.parentNode.insertBefore(js,fjs);
        }
      }(document,"script","twitter-wjs");
    };
    initSocialMedia();
